USE [HomestayWebDB]
GO
/****** Object:  StoredProcedure [dbo].[Store_Post_GetDetailOfPost]    Script Date: 12/12/2012 13:30:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[Store_Post_GetDetailOfPost]
	@PostID int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	SELECT p.PostID,
		   p.Title,
		   p.ContactName,
		   p.Content,
		   p.MobilePhone,
		   p.TelePhone,
		   p.ContactEmail,
		   p.IsAvailable,
		   p.TimeCreated,
		   p.PostStatus,
		   h.Area,
		   h.AddressDetail,
		   h.Province,
		   h.District,
		   h.HasGara,
		   h.HasGarden,
	       h.HasKitchen,
	       h.NumBadroom,
	       h.NumOfWC,
	       h.NumSittingRoom,
	       h.Ordinate,
	       h.PricePerDay,
	       h.PricePerMonth,
	       h.PricePerWeek,
	       h.Storey,
	       t.Name as TypeOfHouse
	FROM Posts p,Houses h, TypeOfHouses t
	WHERE p.PostID = @PostID  AND p.HouseID = h.HouseID AND h.IsDeleted ='False' 
	AND h.TypeOfHouseID = t.TypeOfHouseID 
		  AND p.IsDeleted = 'False' --Check Role later
END

